<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo C('site_name');?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/statics/css/style.css"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/statics/js/calendar/calendar-blue.css"/>

<script type="text/javascript" src="__PUBLIC__/statics/js/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/statics/js/jquery/plugins/formvalidator.js"></script>
<script type="text/javascript" src="__PUBLIC__/statics/js/jquery/plugins/formvalidatorregex.js"></script>
<script type="text/javascript" src="__PUBLIC__/statics/js/jquery/plugins/jquery.imagePreview.js"></script>
<script type="text/javascript" src="__PUBLIC__/statics/js/kindeditor/kindeditor-min.js"></script>
<script type="text/javascript" src="__PUBLIC__/statics/js/calendar/calendar.js"></script>
<script type="text/javascript" src="__PUBLIC__/statics/js/common.js"></script>


<script type="text/javascript">
	function status(id,type){
	    $.get("<?php echo U('ItemsCate/status');?>", { id: id, type: type }, function(data){
			$("#"+type+"_"+id+" img").attr('src', '__PUBLIC__/statics/images/status_'+data.data+'.gif')
		},"json"); 
	}
</script>

</head>
<div class="pad-10" >
    <form id="myform" name="myform" action="<?php echo U('ItemsCate/delete');?>" method="post">
    <div class="table-list">
    <table width="100%" cellspacing="0">
        <thead>
            <tr class="one">
                <th width="5%"><input type="checkbox" value="" id="check_box" onclick="selectall('id[]');"></th>
              	<th width=200>分类名称</th>
                <th width=100>图片</th>
                <th width=100>商品数</th>  
                <th>SEO Title</th>  
                <th width=80>排序值</th>
                <th width=80>首页显示</th>                        
              	<th width=80>操作</th>
            </tr>
        </thead>
    	<tbody>
        <?php if(is_array($cates_list['parent'])): $i = 0; $__LIST__ = $cates_list['parent'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($i % 2 );++$i;?><tr>
            <td align="center"><input type="checkbox" value="<?php echo ($val["id"]); ?>" name="id[]"></td>
            <td><img src="__PUBLIC__/statics/images/tv-collapsable.gif" class="expandable" id="<?php echo ($val["id"]); ?>" style="margin-left:80px"/>&nbsp;&nbsp;<?php echo ($val["name"]); ?></td>
            <td align="center"><?php if($val['img'] != ''): ?><img src="<?php echo C('web_path').ltrim($val['img'],'/'); ?>" height="25px;"/><?php endif; ?></td>
            <td align="center"><em style="color:red;"><?php echo ($val["item_nums"]); ?></em></td>
            <td align="left"><?php echo ($val["seo_title"]); ?></td>
            <td align="center"><input type="text" class="input-text-c input-text" value="<?php echo ($val["ord"]); ?>" size="4" name="orders[<?php echo ($val["id"]); ?>]"  id="listorders[<?php echo ($val["id"]); ?>]" /></td>
            <td align="center" onclick="status(<?php echo ($val["id"]); ?>,'is_index')" id="is_index_<?php echo ($val["id"]); ?>"><img src="__PUBLIC__/statics/images/status_<?php echo ($val["is_index"]); ?>.gif" /></td>
            <td align="center"><a class="blue" href="<?php echo U('ItemsCate/edit',array('id'=>$val['id']));?>">编辑</a></td>
        </tr>
        	<?php if(is_array($cates_list['sub'][$val['id']])): $i = 0; $__LIST__ = $cates_list['sub'][$val['id']];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$sval): $mod = ($i % 2 );++$i;?><tr class="sub_<?php echo ($val["id"]); ?>">
                <td align="center"><input type="checkbox" value="<?php echo ($sval["id"]); ?>" name="id[]"></td>
                <td><img src="__PUBLIC__/statics/images/tv-collapsable.gif" class="expandable" id="<?php echo ($sval["id"]); ?>" style="margin-left:100px" />&nbsp;&nbsp;<?php echo ($sval["name"]); ?></td>
	            <td align="center"><?php if($sval['img'] != ''): ?><img src="<?php echo C('web_path').ltrim($sval['img'],'/'); ?>" height="25px;"/><?php endif; ?></td>
                <td align="center"></td>
                <td align="left"><?php echo ($sval["seo_title"]); ?></td>
				<td align="center"><input type="text" class="input-text-c input-text" value="<?php echo ($sval["ord"]); ?>" size="4" name="orders[<?php echo ($sval["id"]); ?>]" /></td>
                <td align="center"></td>
                <td align="center"><a class="blue" href="<?php echo U('ItemsCate/edit',array('id'=>$sval['id']));?>">编辑</a></td>
            </tr>
                <?php if(is_array($cates_list['sub'][$sval['id']])): $i = 0; $__LIST__ = $cates_list['sub'][$sval['id']];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$ssval): $mod = ($i % 2 );++$i;?><tr class="sub_<?php echo ($val["id"]); ?> sub_<?php echo ($sval["id"]); ?>">
	                <td align="center"><input type="checkbox" value="<?php echo ($ssval["id"]); ?>" name="id[]"></td>
	                <td><img src="__PUBLIC__/statics/images/tv-collapsable.gif" style="margin-left:120px"/>&nbsp;&nbsp;<?php echo ($ssval["name"]); ?></td>
		            <td align="center"><?php if($ssval['img'] != ''): ?><img src="<?php echo C('web_path').ltrim($ssval['img'],'/'); ?>" height="25px;"/><?php endif; ?></td>
	                <td align="center"></td>
	                <td align="left"><?php echo ($ssval["seo_title"]); ?></td>
					<td align="center"><input type="text" class="input-text-c input-text" value="<?php echo ($ssval["ord"]); ?>" size="4" name="orders[<?php echo ($ssval["id"]); ?>]" /></td>
	                <td align="center" onclick="status(<?php echo ($ssval["id"]); ?>,'is_index')" id="is_index_<?php echo ($ssval["id"]); ?>"><img src="__PUBLIC__/statics/images/status_<?php echo ($ssval["is_index"]); ?>.gif" /></td>
	                <td align="center"><a class="blue" href="<?php echo U('ItemsCate/edit',array('id'=>$ssval['id']));?>">编辑</a></td>
	            </tr><?php endforeach; endif; else: echo "" ;endif; endforeach; endif; else: echo "" ;endif; endforeach; endif; else: echo "" ;endif; ?>
    	</tbody>
    </table>
    
    <div class="btn">
    <label for="check_box">全选/取消</label>
    <input type="submit" class="button" name="delete" value="删除" onclick="return check();"/>
    <input type="submit" class="button" name="order" onclick="document.myform.action='<?php echo U('ItemsCate/order');?>'" value="排序"/>
    <div id="pages"><?php echo ($page); ?></div>
    </div>
    </div>
    </form>
</div>
</body>
</html>